package com.haoji.upload.rocketmq;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @program: upload
 * @description:
 * @author: xiaolei
 * @create: 2021-04-21 10:07
 **/
@Slf4j
@Service("mqConsumerService")
public class AbstractMqConsumerServiceImpl implements MqConsumerService {
    @Override
    public ConsumeConcurrentlyStatus beforeHandler(String message) {
        JSONObject object = (JSONObject) JSON.parse(message);
        log.info("mq消息前置处理: message={}", object);
        return null;
    }
    @Override
    public ConsumeConcurrentlyStatus handle(String message) {
        log.info("mq消息处理业务逻辑");
        return null;
    }
    @Override
    public void afterHandler(String message, Date startHandlerTime, ConsumeConcurrentlyStatus status) {
        log.info("mq消息后置处理, status", status);
    }
}
